﻿using parkMonitor.model;
using parkMonitor.viewModel.objectTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace parkMonitor.server.monitorServer {


	/// <summary>值类型</summary>
	public enum ParamValueType {
		e_ushort, e_int
	}

	/// <summary>显示类型</summary>
	public enum ParamShowType {
		/// <summary>字符串</summary>
		e_string,
		/// <summary>固定显示文字</summary>
		e_cbx
	}

	/// <summary>IO类型</summary>
	public enum ParamIOType {
		ReadOnly = 0,
		ReadWrite = 1,
		WriteOnly = 2
	}

	/// <summary>固定显示文字Model</summary>
	public class CbxModel {
		public string value = "";
		public string desc = "";
		public string shortDesc = "";
		public AlarmStatus warnLevel = AlarmStatus.None;
	}

	/// <summary>小类节点</summary>
	public class ListMiddleParam : List<DevParamModel> {
		public DeviceType type = DeviceType.Unknown;
		//public DeviceType subType = DeviceType.Unknown;
		public int subTypeIdx = 0;                  //小类顺序
		public string nameDesc = "";
		public string shortNameType = "";
		public DevTreeItemShowType uiType = DevTreeItemShowType.Default;
		public DeviceType imgType = DeviceType.Unknown;
		public bool isShow = false;
		public bool canReset = false;               //是否可复位
		public string value = "";
	}

	/// <summary>大类节点</summary>
	public class ListRootParam : List<ListMiddleParam> {
		public DeviceType type = DeviceType.Unknown;//大类类型
		public ObjectTreeRootVM rootVM = null;      //VM
		public string nameDesc = "";                //小类描述
	}

	/// <summary>参数Model</summary>
	public class DevParamModel {
		public DeviceType type = DeviceType.Unknown;        //大类类型
															//public DeviceType subType = DeviceType.Unknown;
		public DevTreeItemShowType uiType = DevTreeItemShowType.Default;    //ui显示类型
		public DeviceType imgType = DeviceType.Unknown;     //显示图片类型
															//public string statusName = "";
		public bool isShow = false;                 //是否显示
		public int subTypeIdx = 0;                  //小类顺序
		public int statusIdx = 0;                   //状态顺序
		public Double statusDescWidth = Double.NaN; //树形列表描述宽度
		public string defaultValue = "";            //默认值
		public string value = "";                   //当前值

		public string typeDesc = "";                //大类描述
		public string subTypeDesc = "";             //小类描述
		public string statusDesc = "";              //状态描述
													//public string shortTypeDesc = "";
		public string shortSubTypeDesc = "";        //小类描述简写
		public string shortStatusDesc = "";         //状态描述简写

		public int addr = 0;                        //地址
		public ParamValueType valueType = ParamValueType.e_ushort;  //值类型
		public ParamShowType showType = ParamShowType.e_string;     //显示类型
		public Dictionary<string, CbxModel> mapCbx = new Dictionary<string, CbxModel>();    //枚举类型集合

		public ParamIOType ioType = ParamIOType.ReadOnly;   //读写类型
		public bool canReset = false;                       //是否可复位
	}
}
